$( document ).ready(function() {
	 // Handler for .ready() called.
	$("#assistant-registration-form").validate({
		rules: {
			"guiAssistant.name": {
				required: true
			},
			"guiAssistant.qualifications": {
				required: true
			},
			"guiAssistant.contact.telNo": {
				required: true
			},
			"guiAssistant.contact.address": {
				required: true
			}
		},
	
		messages: {
			"guiAssistant.name": {
				required: "Please specify the assistant name"
			},
			"guiAssistant.qualifications": {
				required: "Please specify the assistant qualifications"
			},
			"guiAssistant.contact.telNo": {
				required: "Please specify the assistant telephone number"
			},
			"guiAssistant.contact.address": {
				required: "Please specify the assistant address"
			}
		},
	
		submitHandler: function(form) { 
			form.submit();  
		}
	});

	//user contact format
	if ($(".user-contact").length > 0) {
		$(".user-contact").mask("(999) 999-9999");
	}

	// init delete button
	if ($("#btn-delete").length > 0) {
		$("#btn-delete").on('click', function(e){
			e.preventDefault();
			$.Dialog({
				shadow: true,
				overlay: true,
				icon: '<span class="icon-remove"></span>',
				title: 'Delete Confirmation',
				width: 400,
				padding: 10,
				onShow: function(_dialog){
 					var content = _dialog.children('.content');
 					content.html('<div class="subheader-secondary" style="width:400px">Do you want to delete assistant\'s all  information?</div><br/><div><a id="btn-delete" href="' + $("#btn-delete").attr('href') + '" class="button">Delete</a></div>');
				}
			});
		});
	}
});
